/* 
 * Selling Partner API for Sellers
 *
 * The Selling Partner API for Sellers lets you retrieve information on behalf of sellers about their seller account, such as the marketplaces they participate in. Along with listing the marketplaces that a seller can sell in, the API also provides additional information about the marketplace such as the default language and the default currency. The API also provides seller-specific information such as whether the seller has suspended listings in that marketplace.
 *
 * OpenAPI spec version: v1
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;

namespace FikaAmazonAPI.AmazonSpApiSDK.Models.Sellers
{
    /// <summary>
    /// Detailed information about an Amazon market where a seller can list items for sale and customers can view and purchase items.
    /// </summary>
    [DataContract]
    public partial class Marketplace : IEquatable<Marketplace>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Marketplace" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        public Marketplace() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="Marketplace" /> class.
        /// </summary>
        /// <param name="Id">The encrypted marketplace value. (required).</param>
        /// <param name="Name">Marketplace name. (required).</param>
        /// <param name="CountryCode">The ISO 3166-1 alpha-2 format country code of the marketplace. (required).</param>
        /// <param name="DefaultCurrencyCode">The ISO 4217 format currency code of the marketplace. (required).</param>
        /// <param name="DefaultLanguageCode">The ISO 639-1 format language code of the marketplace. (required).</param>
        /// <param name="DomainName">The domain name of the marketplace. (required).</param>
        public Marketplace(string Id = default(string), string Name = default(string), string CountryCode = default(string), string DefaultCurrencyCode = default(string), string DefaultLanguageCode = default(string), string DomainName = default(string))
        {
            // to ensure "Id" is required (not null)
            if (Id == null)
            {
                throw new InvalidDataException("Id is a required property for Marketplace and cannot be null");
            }
            else
            {
                this.Id = Id;
            }
            // to ensure "Name" is required (not null)
            if (Name == null)
            {
                throw new InvalidDataException("Name is a required property for Marketplace and cannot be null");
            }
            else
            {
                this.Name = Name;
            }
            // to ensure "CountryCode" is required (not null)
            if (CountryCode == null)
            {
                throw new InvalidDataException("CountryCode is a required property for Marketplace and cannot be null");
            }
            else
            {
                this.CountryCode = CountryCode;
            }
            // to ensure "DefaultCurrencyCode" is required (not null)
            if (DefaultCurrencyCode == null)
            {
                throw new InvalidDataException("DefaultCurrencyCode is a required property for Marketplace and cannot be null");
            }
            else
            {
                this.DefaultCurrencyCode = DefaultCurrencyCode;
            }
            // to ensure "DefaultLanguageCode" is required (not null)
            if (DefaultLanguageCode == null)
            {
                throw new InvalidDataException("DefaultLanguageCode is a required property for Marketplace and cannot be null");
            }
            else
            {
                this.DefaultLanguageCode = DefaultLanguageCode;
            }
            // to ensure "DomainName" is required (not null)
            if (DomainName == null)
            {
                throw new InvalidDataException("DomainName is a required property for Marketplace and cannot be null");
            }
            else
            {
                this.DomainName = DomainName;
            }
        }

        /// <summary>
        /// The encrypted marketplace value.
        /// </summary>
        /// <value>The encrypted marketplace value.</value>
        [DataMember(Name = "id", EmitDefaultValue = false)]
        public string Id { get; set; }

        /// <summary>
        /// Marketplace name.
        /// </summary>
        /// <value>Marketplace name.</value>
        [DataMember(Name = "name", EmitDefaultValue = false)]
        public string Name { get; set; }

        /// <summary>
        /// The ISO 3166-1 alpha-2 format country code of the marketplace.
        /// </summary>
        /// <value>The ISO 3166-1 alpha-2 format country code of the marketplace.</value>
        [DataMember(Name = "countryCode", EmitDefaultValue = false)]
        public string CountryCode { get; set; }

        /// <summary>
        /// The ISO 4217 format currency code of the marketplace.
        /// </summary>
        /// <value>The ISO 4217 format currency code of the marketplace.</value>
        [DataMember(Name = "defaultCurrencyCode", EmitDefaultValue = false)]
        public string DefaultCurrencyCode { get; set; }

        /// <summary>
        /// The ISO 639-1 format language code of the marketplace.
        /// </summary>
        /// <value>The ISO 639-1 format language code of the marketplace.</value>
        [DataMember(Name = "defaultLanguageCode", EmitDefaultValue = false)]
        public string DefaultLanguageCode { get; set; }

        /// <summary>
        /// The domain name of the marketplace.
        /// </summary>
        /// <value>The domain name of the marketplace.</value>
        [DataMember(Name = "domainName", EmitDefaultValue = false)]
        public string DomainName { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class Marketplace {\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  CountryCode: ").Append(CountryCode).Append("\n");
            sb.Append("  DefaultCurrencyCode: ").Append(DefaultCurrencyCode).Append("\n");
            sb.Append("  DefaultLanguageCode: ").Append(DefaultLanguageCode).Append("\n");
            sb.Append("  DomainName: ").Append(DomainName).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="input">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object input)
        {
            return this.Equals(input as Marketplace);
        }

        /// <summary>
        /// Returns true if Marketplace instances are equal
        /// </summary>
        /// <param name="input">Instance of Marketplace to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Marketplace input)
        {
            if (input == null)
                return false;

            return
                (
                    this.Id == input.Id ||
                    (this.Id != null &&
                    this.Id.Equals(input.Id))
                ) &&
                (
                    this.Name == input.Name ||
                    (this.Name != null &&
                    this.Name.Equals(input.Name))
                ) &&
                (
                    this.CountryCode == input.CountryCode ||
                    (this.CountryCode != null &&
                    this.CountryCode.Equals(input.CountryCode))
                ) &&
                (
                    this.DefaultCurrencyCode == input.DefaultCurrencyCode ||
                    (this.DefaultCurrencyCode != null &&
                    this.DefaultCurrencyCode.Equals(input.DefaultCurrencyCode))
                ) &&
                (
                    this.DefaultLanguageCode == input.DefaultLanguageCode ||
                    (this.DefaultLanguageCode != null &&
                    this.DefaultLanguageCode.Equals(input.DefaultLanguageCode))
                ) &&
                (
                    this.DomainName == input.DomainName ||
                    (this.DomainName != null &&
                    this.DomainName.Equals(input.DomainName))
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;
                if (this.Id != null)
                    hashCode = hashCode * 59 + this.Id.GetHashCode();
                if (this.Name != null)
                    hashCode = hashCode * 59 + this.Name.GetHashCode();
                if (this.CountryCode != null)
                    hashCode = hashCode * 59 + this.CountryCode.GetHashCode();
                if (this.DefaultCurrencyCode != null)
                    hashCode = hashCode * 59 + this.DefaultCurrencyCode.GetHashCode();
                if (this.DefaultLanguageCode != null)
                    hashCode = hashCode * 59 + this.DefaultLanguageCode.GetHashCode();
                if (this.DomainName != null)
                    hashCode = hashCode * 59 + this.DomainName.GetHashCode();
                return hashCode;
            }
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // CountryCode (string) pattern
            Regex regexCountryCode = new Regex(@"^([A-Z]{2})$", RegexOptions.CultureInvariant);
            if (false == regexCountryCode.Match(this.CountryCode).Success)
            {
                yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for CountryCode, must match a pattern of " + regexCountryCode, new[] { "CountryCode" });
            }

            yield break;
        }
    }

}
